const http = require("http");
const url = require("url")
const route = require("./assembly/route")
let reg=/\\|\//g;
server = http.createServer(function (req,res){
    res.writeHead(200,{"Content-Type":"application/json"});
    let u = url.parse(req.url).pathname.replace(reg,"");
    console.log('请求路径->',u)
    try{
        route[u](req,res);
    }catch (error){
        console.error('请求报错',error)
        route["error"](req,res);
    }
});
server.listen(8070);
console.log("服务已启动，请访问httpa://localhost:8070")






